package com.hua.yuan;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import cm.hua.yuan.common.utils.AppContextManager;

/**
 * Created by huangyang on 2018/5/8.
 * 父类
 */

public class BaseFragment extends Fragment {

    protected Context context;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.context = AppContextManager.getInstance().getContext();
    }

    @Override
    public void startActivity(final Intent intent) {
        if(getActivity().getPackageManager().resolveActivity(intent,PackageManager.MATCH_DEFAULT_ONLY) != null) {
            super.startActivity(intent);
        }
    }
}
